import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
import { getDictOptions } from '@/utils/dict';
import { useRender } from '@/hooks/component/useRender';
import { DictEnum } from '@/enums/dictEnum';

export const formSchems: FormSchema[] = [
  {
    label: '店铺ID',
    field: 'shopId',
    component: 'Input',
  },
  {
    label: '店铺编码',
    field: 'shopCode',
    component: 'Input',
  },
  {
    label: '店铺名称',
    field: 'shopName',
    component: 'Input',
  },
  {
    label: '店铺手机号',
    field: 'shopPhone',
    component: 'Input',
  },
  {
    label: '店铺状态',
    field: 'status',
    component: 'RadioButtonGroup',
    componentProps: {
      options: getDictOptions(DictEnum.SYS_SHOP_STATUS),
    },
  },
  {
    label: '过期时间',
    field: 'expirationTime',
    component: 'RangePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '创建人',
    field: 'createBy',
    component: 'Input',
  },
];

const { renderDict } = useRender();
export const columns: BasicColumn[] = [
  {
    title: '店铺ID',
    dataIndex: 'shopId',
  },
  {
    title: '店铺编码',
    dataIndex: 'shopCode',
  },
  {
    title: '店铺名称',
    dataIndex: 'shopName',
  },
  {
    title: '店铺手机号',
    dataIndex: 'shopPhone',
  },
  {
    title: '店铺状态',
    dataIndex: 'status',
    customRender: ({ value }) => renderDict(value, DictEnum.SYS_SHOP_STATUS),
  },
  {
    title: '过期时间',
    dataIndex: 'expirationTime',
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
  },
  {
    title: '创建人',
    dataIndex: 'createBy',
  },
  {
    title: '更新人',
    dataIndex: 'updateBy',
  },
  {
    title: '备注',
    dataIndex: 'remark',
  },
];

export const modalSchemas: FormSchema[] = [
  {
    label: 'open-api的appid',
    field: 'appId',
    required: true,
    component: 'Input',
  },
  {
    label: '店铺类型',
    field: 'shopType',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('SHOP_TYPE_LIST'),
    },
  },
  {
    label: '店铺编码',
    field: 'shopCode',
    required: true,
    component: 'Input',
  },
  {
    label: '店铺名称',
    field: 'shopName',
    required: true,
    component: 'Input',
  },
  {
    label: '店铺logo',
    field: 'shopLogo',
    required: true,
    component: 'Input',
  },
  {
    label: '店铺简介',
    field: 'shopBrief',
    required: true,
    component: 'Input',
  },
  {
    label: '省份',
    field: 'shopProvince',
    required: true,
    component: 'Input',
  },
  {
    label: '店铺城市',
    field: 'shopCity',
    required: true,
    component: 'Input',
  },
  {
    label: '店铺地址区',
    field: 'shopArea',
    required: true,
    component: 'Input',
  },
  {
    label: '店铺地址',
    field: 'shopAddress',
    required: true,
    component: 'Input',
  },
  {
    label: '店铺手机号',
    field: 'shopPhone',
    required: true,
    component: 'Input',
  },
  {
    label: '店铺维度',
    field: 'shopLatitude',
    required: true,
    component: 'Input',
  },
  {
    label: '经度',
    field: 'shopLongitude',
    required: true,
    component: 'Input',
  },
  {
    label: '店铺状态',
    field: 'status',
    required: true,
    component: 'RadioButtonGroup',
    componentProps: {
      options: getDictOptions(DictEnum.SYS_SHOP_STATUS),
    },
  },
  {
    label: '下级门店上限',
    field: 'storeUpperLimit',
    required: true,
    component: 'Input',
  },
  {
    label: '商品数量上限',
    field: 'goodsUpperLimit',
    required: true,
    component: 'Input',
  },
  {
    label: '分销海报数量上限',
    field: 'posterUpperLimit',
    required: true,
    component: 'Input',
  },
  {
    label: '会员等级数量上限',
    field: 'memberLevelUpperLimit',
    required: true,
    component: 'Input',
  },
  {
    label: '过期时间',
    field: 'expirationTime',
    required: true,
    component: 'RangePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '自动升级为会员',
    field: 'isDefaultMember',
    required: true,
    component: 'Input',
  },
  {
    label: '需要会员才可操作',
    field: 'isMemberOper',
    required: true,
    component: 'Input',
  },
  {
    label: '需要关注公众号才可操作',
    field: 'isSubscribe',
    required: true,
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    required: true,
    component: 'InputTextArea',
  },
];
